/**
 * Created by sa on 2016/9/28.
 */


// http://www.oicqzone.com/

var casper = require('casper').create({
  pageSettings: {
    loadImages:  false, // 不加载图片，减少请求
  }
});

var fs = require('fs');

casper.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36');

casper.start();
casper.viewport(1024, 768);

casper.then(function() {
  this.open('http://music.163.com/#/m/discover/artist/').then(function(){
    this.page.switchToChildFrame(0); // 页面包含 iFrame
    fs.write("1.html", this.getPageContent(), 'w');  // 保存 iFrame 里的内容

    this.page.switchToParentFrame();
    fs.write("2.html", this.getPageContent(), 'w');
  });
});

casper.run();
